package internal

import (
	"context"

	fpyDcsDb "gf/fpy/dcs/db"
)

func init() {
	fpyDcsDb.SetSoPath("./fpy/dcs/db/.so/db.so")
	fpyDcsDb.SetDbUrl("http://192.168.8.101:11001")
	fpyDcsDb.SetDbSid("0ao6")
}

type AdmAdminDao struct {
	sid 	string
	dbSid   string
	projectSid 	string
	table   string
	group   string
	columns TAdmAdminColumns
}

type TAdmAdminColumns struct {
    Sid    string
    AddTime    string
    UpdateTime    string
    IsDel    string
    Username    string
    Password    string
    Phone    string
    Email    string
    GroupSid    string
    IsSuper    string
    LastLoginIp    string
    LastLoginTime    string
    Nickname    string
    OpenState    string
    Sort    string
}


var cAdmAdminColumns = TAdmAdminColumns{
    Sid:    "sid",
    AddTime:    "add_time",
    UpdateTime:    "update_time",
    IsDel:    "is_del",
    Username:    "username",
    Password:    "password",
    Phone:    "phone",
    Email:    "email",
    GroupSid:    "group_sid",
    IsSuper:    "is_super",
    LastLoginIp:    "last_login_ip",
    LastLoginTime:    "last_login_time",
    Nickname:    "nickname",
    OpenState:    "open_state",
    Sort:    "sort",
}

func NewAdmAdminDao() *AdmAdminDao {
	return &AdmAdminDao{
		sid: 	"0ap6",
		dbSid:	"0ao6",
		projectSid:	"dbd3",
		group:   "adm",
		table:   "admin",
		columns: cAdmAdminColumns,
	}
}

func (dao *AdmAdminDao) Columns() TAdmAdminColumns {
	return dao.columns
}

func (dao *AdmAdminDao) Group() string {
	return dao.group
}

func (dao *AdmAdminDao) Table() string {
	return dao.table
}

func (dao *AdmAdminDao) Ctx(ctx context.Context) *fpyDcsDb.TDb {
	return fpyDcsDb.Ctx(ctx).Table(dao.sid).FpyProjectSid(dao.projectSid)
}